<!DOCTYPE html>
<html>
<head>
    <title>Welcome to Wasm!</title>
    <style>
        body {
            width: 35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
</head>
<body>
<h1>Welcome to wasm!</h1>
<p><em>Thank you for using Wasm</em></p>
<input type="file" id="file" multiple="multiple" onchange="upload()">
</body>
<script>
    // cargo install miniserve
    // miniserve --index index.html
    async function upload() {
        var file = document.getElementById('file').files[0]//获取文件流
        let res = await read_excel_file(file, [1], [], "");
        console.log("excel_json:", res);;
    }

    // read_excel_file_general 读取通用数据
    async function upload2() {
        var file = document.getElementById('file').files[0]//获取文件流
        let res = await read_excel_file_general(file, "");
        console.log("read_excel_file_general:", res);;
    }
</script>
<script type="module">
    // 调用wasm里的方法
    import {default as wasm, greet, read_excel_file, read_excel_file_general} from "./excel_read.js";
    wasm().then((module) => {
        window.read_excel_file = read_excel_file;
        window.read_excel_file_general = read_excel_file_general;
    });
</script>

</html>
